\(\int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx\) [1450]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 94 \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=-3 a b x+\frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}-\frac {b^2 \cos ^3(c+d x)}{3 d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d} \]

[Out]

-3*a*b*x+(a^2+2*b^2)*cos(d*x+c)/d-1/3*b^2*cos(d*x+c)^3/d+(a^2+b^2)*sec(d*x+c)/d+3*a*b*tan(d*x+c)/d-a*b*sin(d*x
+c)^2*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.14 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.259, Rules used = {2990, 2671, 294, 327, 209, 4442, 459} \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=\frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}-3 a b x-\frac {b^2 \cos ^3(c+d x)}{3 d} \]

[In]

Int[Sin[c + d*x]*(a + b*Sin[c + d*x])^2*Tan[c + d*x]^2,x]

[Out]

-3*a*b*x + ((a^2 + 2*b^2)*Cos[c + d*x])/d - (b^2*Cos[c + d*x]^3)/(3*d) + ((a^2 + b^2)*Sec[c + d*x])/d + (3*a*b
*Tan[c + d*x])/d - (a*b*Sin[c + d*x]^2*Tan[c + d*x])/d

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 459

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[ExpandI
ntegrand[(e*x)^m*(a + b*x^n)^p*(c + d*x^n)^q, x], x] /; FreeQ[{a, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0] &
& IGtQ[p, 0] && IGtQ[q, 0]

Rule 2671

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> With[{ff = FreeFactors[Ta
n[e + f*x], x]}, Dist[b*(ff/f), Subst[Int[(ff*x)^(m + n)/(b^2 + ff^2*x^2)^(m/2 + 1), x], x, b*(Tan[e + f*x]/ff
)], x]] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2]

Rule 2990

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*
(x_)])^2, x_Symbol] :> Dist[2*a*(b/d), Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n + 1), x], x] + Int[(g*Cos[e
+ f*x])^p*(d*Sin[e + f*x])^n*(a^2 + b^2*Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && NeQ[a^2 -
 b^2, 0]

Rule 4442

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))], x_Symbol] :> With[{d = FreeFactors[Cos[c*(a + b*x)], x]}, Dist[-d/(
b*c), Subst[Int[SubstFor[1, Cos[c*(a + b*x)]/d, u, x], x], x, Cos[c*(a + b*x)]/d], x] /; FunctionOfQ[Cos[c*(a
+ b*x)]/d, u, x]] /; FreeQ[{a, b, c}, x] && (EqQ[F, Sin] || EqQ[F, sin])

Rubi steps \begin{align*} \text {integral}& = (2 a b) \int \sin ^2(c+d x) \tan ^2(c+d x) \, dx+\int \sin (c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \tan ^2(c+d x) \, dx \\ & = -\frac {\text {Subst}\left (\int \frac {\left (1-x^2\right ) \left (a^2+b^2-b^2 x^2\right )}{x^2} \, dx,x,\cos (c+d x)\right )}{d}+\frac {(2 a b) \text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{d} \\ & = -\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}-\frac {\text {Subst}\left (\int \left (-a^2 \left (1+\frac {2 b^2}{a^2}\right )+\frac {a^2+b^2}{x^2}+b^2 x^2\right ) \, dx,x,\cos (c+d x)\right )}{d}+\frac {(3 a b) \text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d} \\ & = \frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}-\frac {b^2 \cos ^3(c+d x)}{3 d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d}-\frac {(3 a b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{d} \\ & = -3 a b x+\frac {\left (a^2+2 b^2\right ) \cos (c+d x)}{d}-\frac {b^2 \cos ^3(c+d x)}{3 d}+\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {3 a b \tan (c+d x)}{d}-\frac {a b \sin ^2(c+d x) \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.63 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.11 \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=\frac {\sec (c+d x) \left (36 a^2+45 b^2-24 \left (a^2+b^2+3 a b (c+d x)\right ) \cos (c+d x)+4 \left (3 a^2+5 b^2\right ) \cos (2 (c+d x))-b^2 \cos (4 (c+d x))+54 a b \sin (c+d x)+6 a b \sin (3 (c+d x))\right )}{24 d} \]

[In]

Integrate[Sin[c + d*x]*(a + b*Sin[c + d*x])^2*Tan[c + d*x]^2,x]

[Out]

(Sec[c + d*x]*(36*a^2 + 45*b^2 - 24*(a^2 + b^2 + 3*a*b*(c + d*x))*Cos[c + d*x] + 4*(3*a^2 + 5*b^2)*Cos[2*(c +
d*x)] - b^2*Cos[4*(c + d*x)] + 54*a*b*Sin[c + d*x] + 6*a*b*Sin[3*(c + d*x)]))/(24*d)

Maple [A] (verified)

Time = 0.83 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.14

method result size
parallelrisch \(\frac {\left (12 a^{2}+20 b^{2}\right ) \cos \left (2 d x +2 c \right )-b^{2} \cos \left (4 d x +4 c \right )+6 a b \sin \left (3 d x +3 c \right )+\left (-72 a b x d +48 a^{2}+64 b^{2}\right ) \cos \left (d x +c \right )+54 a b \sin \left (d x +c \right )+36 a^{2}+45 b^{2}}{24 d \cos \left (d x +c \right )}\) \(107\)
derivativedivides \(\frac {a^{2} \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+2 a b \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b^{2} \left (\frac {\sin ^{6}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin ^{4}\left (d x +c \right )+\frac {4 \left (\sin ^{2}\left (d x +c \right )\right )}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(147\)
default \(\frac {a^{2} \left (\frac {\sin ^{4}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (2+\sin ^{2}\left (d x +c \right )\right ) \cos \left (d x +c \right )\right )+2 a b \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b^{2} \left (\frac {\sin ^{6}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin ^{4}\left (d x +c \right )+\frac {4 \left (\sin ^{2}\left (d x +c \right )\right )}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(147\)
risch \(-3 a b x -\frac {i a b \,{\mathrm e}^{2 i \left (d x +c \right )}}{4 d}+\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {7 b^{2} {\mathrm e}^{i \left (d x +c \right )}}{8 d}+\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {7 \,{\mathrm e}^{-i \left (d x +c \right )} b^{2}}{8 d}+\frac {i a b \,{\mathrm e}^{-2 i \left (d x +c \right )}}{4 d}+\frac {4 i a b +2 a^{2} {\mathrm e}^{i \left (d x +c \right )}+2 b^{2} {\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {b^{2} \cos \left (3 d x +3 c \right )}{12 d}\) \(176\)
norman \(\frac {-\frac {12 a^{2}+16 b^{2}}{3 d}+3 a b x -\frac {4 a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 \left (12 a^{2}+16 b^{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {6 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {10 a b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {10 a b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {6 a b \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+6 a b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-6 a b x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a b x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}\) \(218\)

[In]

int(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/24*((12*a^2+20*b^2)*cos(2*d*x+2*c)-b^2*cos(4*d*x+4*c)+6*a*b*sin(3*d*x+3*c)+(-72*a*b*d*x+48*a^2+64*b^2)*cos(d
*x+c)+54*a*b*sin(d*x+c)+36*a^2+45*b^2)/d/cos(d*x+c)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 91, normalized size of antiderivative = 0.97 \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=-\frac {b^{2} \cos \left (d x + c\right )^{4} + 9 \, a b d x \cos \left (d x + c\right ) - 3 \, {\left (a^{2} + 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 3 \, a^{2} - 3 \, b^{2} - 3 \, {\left (a b \cos \left (d x + c\right )^{2} + 2 \, a b\right )} \sin \left (d x + c\right )}{3 \, d \cos \left (d x + c\right )} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/3*(b^2*cos(d*x + c)^4 + 9*a*b*d*x*cos(d*x + c) - 3*(a^2 + 2*b^2)*cos(d*x + c)^2 - 3*a^2 - 3*b^2 - 3*(a*b*co
s(d*x + c)^2 + 2*a*b)*sin(d*x + c))/(d*cos(d*x + c))

Sympy [F]

\[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=\int \left (a + b \sin {\left (c + d x \right )}\right )^{2} \sin ^{3}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(sec(d*x+c)**2*sin(d*x+c)**3*(a+b*sin(d*x+c))**2,x)

[Out]

Integral((a + b*sin(c + d*x))**2*sin(c + d*x)**3*sec(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.03 \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=-\frac {3 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} a b + {\left (\cos \left (d x + c\right )^{3} - \frac {3}{\cos \left (d x + c\right )} - 6 \, \cos \left (d x + c\right )\right )} b^{2} - 3 \, a^{2} {\left (\frac {1}{\cos \left (d x + c\right )} + \cos \left (d x + c\right )\right )}}{3 \, d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/3*(3*(3*d*x + 3*c - tan(d*x + c)/(tan(d*x + c)^2 + 1) - 2*tan(d*x + c))*a*b + (cos(d*x + c)^3 - 3/cos(d*x +
 c) - 6*cos(d*x + c))*b^2 - 3*a^2*(1/cos(d*x + c) + cos(d*x + c)))/d

Giac [A] (verification not implemented)

none

Time = 0.41 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.83 \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=-\frac {9 \, {\left (d x + c\right )} a b + \frac {6 \, {\left (2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2} + b^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} + \frac {2 \, {\left (3 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 3 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2} - 5 \, b^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3}}}{3 \, d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^3*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

-1/3*(9*(d*x + c)*a*b + 6*(2*a*b*tan(1/2*d*x + 1/2*c) + a^2 + b^2)/(tan(1/2*d*x + 1/2*c)^2 - 1) + 2*(3*a*b*tan
(1/2*d*x + 1/2*c)^5 - 3*a^2*tan(1/2*d*x + 1/2*c)^4 - 3*b^2*tan(1/2*d*x + 1/2*c)^4 - 6*a^2*tan(1/2*d*x + 1/2*c)
^2 - 12*b^2*tan(1/2*d*x + 1/2*c)^2 - 3*a*b*tan(1/2*d*x + 1/2*c) - 3*a^2 - 5*b^2)/(tan(1/2*d*x + 1/2*c)^2 + 1)^
3)/d

Mupad [B] (verification not implemented)

Time = 18.28 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.59 \[ \int \sin (c+d x) (a+b \sin (c+d x))^2 \tan ^2(c+d x) \, dx=-3\,a\,b\,x-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (8\,a^2+\frac {32\,b^2}{3}\right )+4\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+4\,a^2+\frac {16\,b^2}{3}+10\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+10\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+6\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+6\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^3} \]

[In]

int((sin(c + d*x)^3*(a + b*sin(c + d*x))^2)/cos(c + d*x)^2,x)

[Out]

- 3*a*b*x - (tan(c/2 + (d*x)/2)^2*(8*a^2 + (32*b^2)/3) + 4*a^2*tan(c/2 + (d*x)/2)^4 + 4*a^2 + (16*b^2)/3 + 10*
a*b*tan(c/2 + (d*x)/2)^3 + 10*a*b*tan(c/2 + (d*x)/2)^5 + 6*a*b*tan(c/2 + (d*x)/2)^7 + 6*a*b*tan(c/2 + (d*x)/2)
)/(d*(tan(c/2 + (d*x)/2)^2 - 1)*(tan(c/2 + (d*x)/2)^2 + 1)^3)